<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/static/layui/css/layui.css?t=1483944306685" media="all">
</head>
<body>
<div class="layadmin-tabsbody-item layui-show">
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-header">职位检索</div>
                    <div class="layui-card-body">
                        <div class="layui-btn-group test-table-operate-btn" style="margin-bottom: 10px;">
                            <form class="layui-form" action="">

                                <div class="layui-form-item">
                                    {% if provinces %}
                                        <div class="layui-inline">
                                            <label class="layui-form-label">省份</label>
                                            <div class="layui-input-inline">
                                                <select name="province" id="zw_province" lay-filter="provinceSelect">
                                                    <option value="0">请选择</option>
                                                    {% for province in provinces %}
                                                        <option value="{{ province }}">{{ province }}</option>
                                                    {% endfor %}
                                                </select>
                                            </div>
                                        </div>
                                    {% endif %}
                                    {% if cities %}
                                        <div class="layui-inline">
                                            <label class="layui-form-label">城市</label>
                                            <div class="layui-input-inline">
                                                <select name="city" id="zw_city">
                                                    <option value="0">请选择</option>
                                                    {% for city in cities %}
                                                        <option value="{{ city.id }}">{{ city.dd_name }}</option>
                                                    {% endfor %}
                                                </select>
                                            </div>
                                        </div>
                                    {% endif %}
                                    <div class="layui-inline">
                                        <label class="layui-form-label">公司性质</label>
                                        <div class="layui-input-inline">
                                            <select name="gsxz" id="zw_gsxz">
                                                <option value="0">请选择</option>
                                                {% for item in gsxz %}
                                                    <option value="{{ item.id }}">{{ item.gsxz_name }}</option>
                                                {% endfor %}
                                            </select>
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">公司规模</label>
                                        <div class="layui-input-inline">
                                            <select name="gsgm" id="zw_gsgm">
                                                <option value="0">请选择</option>
                                                {% for item in gsgm %}
                                                    <option value="{{ item.id }}">{{ item.gsgm_name }}</option>
                                                {% endfor %}
                                            </select>
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">学历</label>
                                        <div class="layui-input-inline">
                                            <select name="xl" id="zw_xl">
                                                <option value="0">请选择</option>
                                                {% for item in xl %}
                                                    <option value="{{ item.id }}">{{ item.xl_name }}</option>
                                                {% endfor %}
                                            </select>
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">工作经验</label>
                                        <div class="layui-input-inline">
                                            <select name="gzjy" id="zw_gzjy">
                                                <option value="0">请选择</option>
                                                {% for item in gzjy %}
                                                    <option value="{{ item.id }}">{{ item.gzjy_name }}</option>
                                                {% endfor %}
                                            </select>
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">公司行业</label>
                                        <div class="layui-input-inline">
                                            <select name="gshy" id="zw_gshy">
                                                <option value="0">请选择</option>
                                                {% for item in gshy %}
                                                    <option value="{{ item.id }}">{{ item.gshy_name }}</option>
                                                {% endfor %}
                                            </select>
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">大分类</label>
                                        <div class="layui-input-inline">
                                            <select name="zwlb_big" id="zw_zwlb_big" lay-filter="zwlbBigSelect">
                                                <option value="0">请选择</option>
                                                {% for item in zwlb_big %}
                                                    <option value="{{ item.id }}">{{ item.zwlb_big_name }}</option>
                                                {% endfor %}
                                            </select>
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">小分类</label>
                                        <div class="layui-input-inline">
                                            <select name="zwlb" id="zw_zwlb">
                                                <option value="0">请选择</option>
                                                {% for item in zwlb %}
                                                    <option value="{{ item.id }}">{{ item.zwlb_name }}</option>
                                                {% endfor %}
                                            </select>
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label"></label>
                                        <div class="layui-input-inline">
                                            <button class="layui-btn" lay-submit lay-filter="zwSearchSumbit">检索</button>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                        <table class="layui-hide" id="test-table-cellEdit" lay-filter="book-table"></table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="/static/js/jquery-1.12.0.min.js" type="text/javascript"></script>
<script src="/static/layui/layui.js?t=1483944306685" charset="utf-8" type="text/javascript"></script>
<script>
    layui.use(['jquery', 'layer', 'element', 'table', 'form'], function () {
        var $ = layui.jquery,
            element = layui.element,
            layer = layui.layer, table = layui.table, form = layui.form;

        function getZwList(data) {
            if (data == '') {
                data = {}
            }
            var index = layer.load(3);
            table.render({
                elem: '#test-table-cellEdit'
                , url: '/zw/list'
                , cols: [[
                    {field: 'id', title: 'ID', sort: true}
                    , {field: 'zwmc_name', title: '职位名'}
                    , {field: 'gsmc_name', title: '公司名'}
                    , {field: 'dd_name', title: '地点'}
                    , {field: 'gsxz_name', title: '公司性质'}
                    , {field: 'gsgm_name', title: '公司规模'}
                    , {field: 'xl_name', title: '学历'}
                    , {field: 'gzjy_name', title: '工作经验'}
                    , {field: 'gshy_name', title: '公司行业'}
                    , {field: 'zwlb_name', title: '职位类别'}
                    , {field: 'min_zwyx', title: '最低薪资', sort: true}
                    , {field: 'max_zwyx', title: '最高薪资', sort: true}
                ]],
                where: data,
                page: {
                    layout: ['count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
                    , groups: 5
                    , limit: 10
                }
                , even: true //开启隔行背景
                , done: function (res, curr, count) {
                    layer.close(index);
                },
                text: {
                    none: '暂无相关数据,请重新检索' //默认：无数据。注：该属性为 layui 2.2.5 开始新增
                }
            });
        }

        getZwList('');
        //监听提交
        form.on('submit(zwSearchSumbit)', function (data) {
            getZwList(data.field);
            return false;
        });
        // 省份
        form.on('select(provinceSelect)', function (data) {
            if (data.value != 0) {
                $.ajax({
                    url: '/get/city/list',
                    data: {'province': data.value},
                    dataType: 'json',
                    success: function (returnData) {
                        var city_list = '<option value="0">请选择</option>';
                        $.each(returnData, function (index, item) {
                            city_list = city_list + '<option value="' + item.id + '">' + item.dd_name + '</option>'
                        });
                        $("#zw_city").html(city_list);
                        form.render('select')
                    }
                });
            }
        });
        // 大分类
        form.on('select(zwlbBigSelect)', function (data) {
            if (data.value != 0) {
                $.ajax({
                    url: '/get/zwlb/list',
                    data: {'zwlb': data.value},
                    dataType: 'json',
                    success: function (returnData) {
                        var zwlb_list = '<option value="0">请选择</option>';
                        $.each(returnData, function (index, item) {
                            zwlb_list = zwlb_list + '<option value="' + item.id + '">' + item.zwlb_name + '</option>'
                        });
                        $("#zw_zwlb").html(zwlb_list);
                        form.render('select')
                    }
                });
            }
        });
    });
</script>
</body>
</html>